﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using nHydrate.Generator.Common.Util;

namespace nHydrate.Generator.Common.GeneratorFramework
{
	public class UserSettings
	{
		private string Filename
		{
			get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "nhydrate.settings"); }
		}

		public void Load()
		{
			var document = new XmlDocument();
			try
			{
				document.Load(this.Filename);
			}
			catch { return; }

		}

		public void Save()
		{
			var document = new XmlDocument();
			document.LoadXml("<settings><settings>");

			var ovNode = XmlHelper.AddElement(document.DocumentElement, "ObjectView");
			var mwNode = XmlHelper.AddElement((XmlElement)ovNode, "MainWindow");
			var swNode = XmlHelper.AddElement((XmlElement)ovNode, "SubWindow");
			document.Save(this.Filename);
		}
	}

	public class ObjectViewColumn
	{
		public string Name { get; internal set; }
		public int Width { get; internal set; }
	}

}
